import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { parkPlaceVO, parkPlaceForm, parkPlaceQuery } from '@/api/park/park-place/types';

/**
 * 查询园区区域列表
 * @param query
 * @returns {*}
 */

export const listparkPlace = (query?: parkPlaceQuery): AxiosPromise<parkPlaceVO[]> => {
  return request({
    url: '/park/park-place/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询园区区域详细
 * @param parkPlaceId
 */
export const getparkPlace = (parkPlaceId: string | number): AxiosPromise<parkPlaceVO> => {
  return request({
    url: '/park/park-place/' + parkPlaceId,
    method: 'get'
  });
};

/**
 * 新增园区区域
 * @param data
 */
export const addparkPlace = (data: parkPlaceForm) => {
  return request({
    url: '/park/park-place',
    method: 'post',
    data: data
  });
};

/**
 * 修改园区区域
 * @param data
 */
export const updateparkPlace = (data: parkPlaceForm) => {
  return request({
    url: '/park/park-place',
    method: 'put',
    data: data
  });
};

/**
 * 删除园区区域
 * @param parkPlaceId
 */
export const delparkPlace = (parkPlaceId: string | number | Array<string | number>) => {
  return request({
    url: '/park/park-place/' + parkPlaceId,
    method: 'delete'
  });

};
/**
 * 园区区域树形结构**/
export const parkTreeList = (query?: parkPlaceQuery): AxiosPromise<parkPlaceVO[]> => {
  return request({
    url: '/park/park-place/parkTreeList',
    method: 'get',
    params: query
  });

};
/***位置详情* */
export const securityPlatParkPlaceIdDetail = (id: string | number): AxiosPromise<parkPlaceVO> => {
  return request({
    url: '/equipment/securityPlat/securityPlatParkPlaceIdDetail/' + id,
    method: 'get'
  });
};
/**查询园区整体情况** */
export const securityPlatDetail = () => {
  return request({
    url: '/equipment/securityPlat/securityPlatDetail',
    method: 'get'
  });
};

export const securityPlatById = (id: string | number): AxiosPromise<parkPlaceVO> => {
  return request({
    url: '/equipment/securityPlat/' + id,
    method: 'get'
  });
};
/**点位详情* */
export const pointDetailById = (id: string | number): AxiosPromise<parkPlaceVO> => {
  return request({
    url: '/equipment/securityPlat/getPointDetail/' + id,
    method: 'get'
  });
};
/**同步gis瓦片地图路径*/
export const syncDate = () => {
  return request({
    url: '/park/park-place/syncDate',
    method: 'get'
  });
};
export const selectParkPlacePointByPlaceId = (id: string | number): AxiosPromise<parkPlaceVO> => {
  return request({
    url: '/park/park-place/selectParkPlacePointByPlaceId/' + id,
    method: 'get'
  });
};
export const getTokenUrl = (query?: parkPlaceQuery) => {
  return request({
    url: '/park/park-place/getToken',
    method: 'get',
    params: query
  });
};

